package acceptanceTests.unauthrizedDelete;

import acceptanceTests.registration.RegistrationInt;
import acceptanceTests.registration.RegistrationProxy;
import junit.framework.TestCase;

public class UnauthorizedDeleteStoryTest extends TestCase {
	
	RegistrationInt _forumRegimp = new RegistrationProxy();
	UnauthorizedDeleteInt _unauthorizedImp= new UnauthorizedDeleteProxy(_forumRegimp.getServer());
	
	public UnauthorizedDeleteStoryTest(){
		super();
	}
	

	public void testUnauthorizedDelete(){
		_forumRegimp.deleteRegisterUser("user1");
		assertTrue(_forumRegimp.register("user1","abc@gmail.com","password1"));
		Object tTopic1 = _unauthorizedImp.getLegalTopicForNewMessage("user1");
		Object tMessage =_unauthorizedImp.writeNewMessageReturnsMessage("test2", "body2", tTopic1, "user1");
		assertTrue(_unauthorizedImp.hasMessage(tMessage, "user1"));
		assertFalse(_unauthorizedImp.deleteMessage(tMessage));
		assertTrue(_unauthorizedImp.hasMessage(tMessage, "user1"));
		assertTrue( _forumRegimp.deleteRegisterUser("user1") );
		
		
	
	}


}
